#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
#include<vector>
//void test01()
//{
//	//construct
//	vector<int> v1(15,1);
//	vector<int> v2(v1);
//	vector<int> v3;
//	vector<int> v4(v2.begin(), v2.end());
////	for (int i = 0; i < v1.size(); i++)
////	{
////		cout << v1[i] << " ";
////	}
////	cout << endl;
//	cout << "v2--capacity:" << v2.capacity() << endl;
//	//v2.resize(20);
//	//v2.resize(6);
//	//v2.resize(15,'l');
//	v2.reserve(25);
//	cout << "v2--growcapacity:" << v2.capacity() << endl;
//	//for (int i = 0; i < v2.size(); i++)
//	//{
//	//	cout << v2[i] << " ";
//	//}
//	vector<int>::iterator it = v2.begin();
//	while (it != v2.end())
//	{
//		cout << *it << " ";
//		++it;
//	}
//	cout << endl;
//	for (auto ch : v2)
//	{
//		cout << ch<<" ";
//	}
//
//}
void TestVectorExpand()
{
	size_t sz;
	vector<int> v;
	v.reserve(100);

	sz = v.capacity();
	cout << "capacity changed: " << sz << '\n';

	cout << "making v grow:\n";
	for (int i = 0; i < 100; ++i)
	{
		v.push_back(i);
		if (sz != v.capacity())
		{
			sz = v.capacity();
			cout << "capacity changed: " << sz << '\n';
		}
	}
}
void test_vector2()
{
	//TestVectorExpand();

	vector<int> v(10, 1);
	v.reserve(20);
	cout << v.size() << endl;
	cout << v.capacity() << endl;

	v.reserve(15);
	cout << v.size() << endl;
	cout << v.capacity() << endl;

	v.reserve(5);
	cout << v.size() << endl;
	cout << v.capacity() << endl;
}
void test_vector3()
{
	vector<int> v1(5, 9);
	v1.push_back(0);
	v1.pop_back();
	//v1.insert(v1.begin()+2, 0);
	//v1.insert(v1.begin() + 2,4, 0);
	v1.erase(v1.begin()+2);
	v1.clear();
	for (auto ch : v1)
	{
		cout << ch << " ";
	}
	//vector<int> v2(5, 0);
	//for (int i = 0; i < 5; i++)
	//{
	//	cin >> v2[i];
	//}
	//for (auto ch : v2)
	//{
	//	cout << ch << " ";
	//}
}
void test_vector5()
{/*
	vector<string> v1;
	string s1("xxxx");
	v1.push_back(s1);

	v1.push_back("yyyyy");
	for (const auto& e : v1)
	{
		cout << e << " ";
	}*/
	cout << endl;
	vector<int> v(5, 1);
	vector<vector<int>> vv(5,v);
	cout << vv[1][1]<<endl;
}
int main()
{
	void test_vector5();
	//TestVectorExpand();
}